<div>
	<div class="con"  style="-moz-user-select:none;">
		<table id="teamconsumeadjustlog"></table>
	</div>
</div>
<script>
	var teamconsumeadjustlogReload = function () {
		$("#teamconsumeadjustlog").datagrid('reload');
	};
	var teamconsumeadjustlogSearch = function () {
		var height = 466;
		var width = 938;
		$("#teamconsumeadjustlog").datagrid({
			width: width,
			height: height,//高度
			singleSelect: true,//如果为true，则只允许选择一行
			striped: true,//是否显示斑马线效果。
			rownumbers: false,//如果为true，则显示一个行号列。
			pagination: true,//是否显示分页
			pageSize: 10,
			pageList: [10, 15, 20, 25],
			method: 'post',
			sortName: 'created_at',
			sortOrder: 'desc',
			idField: 'id',
			treeField: 'title',
			url: '/admin/agent/teamconsumeadjustlog',
			queryParams: {
				id: '<?php echo $id;?>',
			},
			fitColumns: true,//真正的自动展开/收缩列的大小，以适应网格的宽度，防止水平滚动。
			nowrap: true,//如果为true，则在同一行中显示数据。设置为true可以提高加载性能。 是否换行
			selectOnCheck: false,
			checkOnSelect: true,
			toolbar: '',
			columns: [[
				{field: 'id', title: 'ID', width: fixWidth(4)},
				{
					field: 'member',
					title: '代理商',
					width: fixWidth(15),
					formatter: function (value, rowData, rowIndex) {
						return '<div  style="line-height: 20px">ID:' + rowData.member.id + '<br>' +
								'昵称：' + (rowData.member.realname ? rowData.member.realname : rowData.member.nickname) + '<br>' +
								'电话：' + (rowData.member.phone ? rowData.member.phone : '') + '</div>';
					}
				},
				{field: 'event_name',title:'调整事项',width:fixWidth(8)},
				{field:'adjust',title:'调整数值',width:fixWidth(8), formatter(value, rowData){
					let content = '';
					if(value < 0){
						content = '<span style="color:#189e02">'+value+'</span>';
					}else {
						content = '<span style="color:#b80303">'+value+'</span>';
					}
						return content;
					}},

				{field:'before',title:'前后变动',width:fixWidth(10), align:'center', formatter(value, rowData){
						return '<p style="color:#e57621">'+value+'</p> ==> <p style="color:#0903a5">'+rowData.after+'</p>';
					}},
				{field:'oper_type_text',title:'调整人员',width:fixWidth(8), formatter(value, rowData){
						return value + '(' + rowData.oper_id + ')';
					}},
				{field:'remark',title:'用户备注',width:fixWidth(10)},
				{field:'created_at',title:'时间',width:fixWidth(8), align:'center', formatter(value, rowData){
					let created_at_sp = value.split(' ');
					let content = '';
					for (let i =0; i<created_at_sp.length; i++){
						content += '<p>'+created_at_sp[i]+'</p>';
					}
					return content;
				}},
			]]
		});
	};
	onDatagridResize("#teamconsumeadjustlog");
	teamconsumeadjustlogSearch();
</script>